
<meta charset="utf-8">
<div class="box" id="biz_pmpBugs_conatainer">
	<div class="box-header with-border">
		<form id="searchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>负责人</label> 
				<select type="text" name="chargeUserId"
					v-model="searchForm.chargeUserId"
					v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.chargeUserId',firstEmpty:'true'}"
					class="form-control" id="chargeUserId">
				</select>
			</div>
			<div class="form-group">
				<label>指派人</label> 
				<select type="text" name="assignUserId"
					v-model="searchForm.assignUserId"
					v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.assignUserId',firstEmpty:'true'}"
					class="form-control" id="assignUserId">
				</select>
			</div>
			<!-- <div class="form-group">
				<label>来源</label> 
				<select id="bugFrom" name="bugFrom" v-model="searchForm.bugFrom" class=" form-control">
					<option value="1">任务</option>
					<option value="2">需求</option>
					<option value="3">bug</option>
					<option value="4">其他</option>
				</select>
			</div> -->
			<div class="form-group">
				<label>状态</label> 
				<select id="status" name="status" v-model="searchForm.status" class=" form-control">
					<option value="1">未指派</option>
					<option value="2">待解决</option>
					<option value="3">进行中</option>
					<option value="4">修改并提交</option>
					<option value="5">测试验收</option>
					<option value="6">测试驳回</option>
					<option value="7">经理驳回</option>
					<option value="8">已完成</option>
					<option value="9">延期处理</option>
					<option value="10">取消</option>
					<option value="-1">已删除</option>
				</select>
			</div>
			<div class="form-group">
				<label>优先级</label> <select id="priority" name="priority" v-model="searchForm.priority" class=" form-control">
					<option value="1">低</option>
					<option value="2">中等</option>
					<option value="3">急</option>
					<option value="4">加急</option>
				</select>
			</div>
		 	<div class="form-group">
				<label>严重程度</label> 
				<select id="severity" name="severity" v-model="searchForm.severity" class=" form-control">
					<option value="1">轻微</option>
					<option value="2">小调整</option>
					<option value="3">中等</option>
					<option value="4">严重</option>
					<option value="5">非常严重</option>
					<option value="6">宕机</option>
				</select>
			</div> 
			
			<!-- <div class="form-group">
				<label>难度系数</label> 
				<select id="difficultyScoreId"
					name="difficultyScoreId" v-model="searchForm.difficultyScoreId"
					v-kselect="{url:'/pmp/service/pub/pmpALine/loadDifScoreComboboVo',vmodel:'searchForm.difficultyScoreId',firstEmpty:'true'}"
					class=" form-control">
				</select>
			</div> -->
			<button type="button" class="btn btn-info pull-right m-t-n-xs" v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="pmpBugsTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 创建BUG
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="assign">
						<i class="glyphicon glyphicon-share" aria-hidden="true"></i> 指派BUG
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="">
						<i class="glyphicon glyphicon-time" aria-hidden="true"></i> 截止时间
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="testerCheck">
						<i class="glyphicon glyphicon-floppy-open" aria-hidden="true"></i> 测试验收
					</button>
				
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="pmCheck">
						<i class="glyphicon glyphicon-floppy-open" aria-hidden="true"></i> 经理验收
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="modifySubmit">
						<i class="glyphicon glyphicon-wrench" aria-hidden="true"></i>修改提交
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="doDelete">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> BUG删除
					</button>

				</div>
				<table id="pmpBugsBootstrapTable" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
</div>
<script>
var biz_pmpBugs_conatainer_main=new Vue({  
	  el: '#biz_pmpBugs_conatainer',
	  data:{
		  projectId: null,
		  searchForm:{
			  projectId : null,
			  chargeUserId : null,
			  status : null,
			  difficultyScoreId : null,
			  priority : null,
			  severity : null,
			  frequency :null,
			  assignUserId : null,
			  bugFrom : null
		 },
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		  _this.projectId=  zfesRoutie.getUrlPatam("id");
		   _this.searchForm.projectId=  _this.projectId;
		  _this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
 
  		var columns=[
  					{checkbox:true},
  					{field:'bug_name',title:'名称',width:160},
					//{field:'bug_from',title:'来源于需求',width:60,formatter:_this.formatFromType},
					//{field:'bug_detail',title:'详情',width:100},
  					{field:'charge_user_name',title:'责任人',width:40},
  					{field:'assign_user_name',title:'负责人',width:40},
  					{field:'difficulty_score_name',title:'难度系数',width:40},
  					{field:'priority',title:'优先级',width:40,formatter:pmpFormat.formatPriority},
  					{field:'severity',title:'严重程度',width:40,formatter:pmpFormat.formatBugSeverity},
  					{field:'frequency',title:'出现频率',width:40,formatter:pmpFormat.formatBugFrequency},
  					{field:'deduce_score',title:'扣分',width:40},
  					{field:'expiry_time',title:'截止时间',width:100},
  					{field:'expired',title:'超时',width:40,formatter:pmpFormat.formatBugExpired},
  					{field:'assign_hours',title:'指派时间',width:40},
  					{field:'work_hours',title:'投入时间',width:40},
  					{field:'progress',title:'进度',width:100,formatter:pmpFormat.formatProcess},
  					{field:'status',title:'状态',width:40,formatter:pmpFormat.formatBugStatus}];
  		  var url="/pmp/service/pm/pmpBugs/loadPmpBugsDataSet";
    		zfesBstable.laodTable($("#pmpBugsBootstrapTable"),$("#searchForm"),$("#pmpBugsTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpBugsBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpBugsBootstrapTable"));
  	  },
  	  add:function(){
  		  var　_this=this;
  		 var url="/views/pmpBugs/pmpBugs.add.tester.html";
  		 zfesLayerEditDg.open(url,{},"添加bug",660,function(){_this.refresh();});
  		 
  	  },
  	 edit: function(){
		  var　_this=this;
		 var url="/views/cloudMember/cloudMember.add.html";
		 zfesLayerEditDg.open(url,{},"添加bug",660,function(){_this.refresh();});
		 
	  },
	  assign: function(){
		  if(zfesBstable.isOneRow($("#pmpBugsBootstrapTable"))){
			  var　_this=this;
			  var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
			  var url="/views/pmpBugs/pmpBugs.edit.ma.html";
			  zfesLayerEditDg.open(url,{"id":id},"bug指派",660,function(){_this.refresh();}); 
		 }
	  },
	  testerCheck: function(){
		  if(zfesBstable.isSelectedRow($("#pmpBugsBootstrapTable"))){
  			  var　_this=this;
  			  var ids=zfesBstable.getRowIds($("#pmpBugsBootstrapTable"));
  			  var url="/views/pmpBugs/pmpBugs.check.tester.html";
  			  zfesLayerEditDg.open(url,{"ids":ids},"bug验收",360,function(){_this.refresh();}); 
  		 }
	  },
	  pmCheck: function(){
		  if(zfesBstable.isSelectedRow($("#pmpBugsBootstrapTable"))){
  			  var　_this=this;
  			  var ids=zfesBstable.getRowIds($("#pmpBugsBootstrapTable"));
  			
  			  var url="/views/pmpBugs/pmpBugs.check.pm.html";
  			  zfesLayerEditDg.open(url,{"ids":ids},"bug验收",360,function(){_this.refresh();}); 
  		 }
	  },
	  modifySubmit: function(){
		  if(zfesBstable.isOneRow($("#pmpBugsBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
  			  var url="/views/pmpBugs/pmpBugs.check.pm.html";
  			  zfesLayerEditDg.open(url,{"userId":id},"取消bug",600,function(){_this.refresh();}); 
  		 } 
	  },
  	  cancel:function(){
  		  if(zfesBstable.isOneRow($("#pmpBugsBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
  			  var url="/views/cloudMember/cloudMember.setPwd.html";
  			  zfesLayerEditDg.open(url,{"userId":id},"取消bug",600,function(){_this.refresh();}); 
  		 }
  	  },
  	 doDelete: function(){
  		if(zfesBstable.isSelectedRow($("#pmpBugsBootstrapTable"))){
			  var　_this=this;
			    var id=zfesBstable.getRowId($("#pmpBugsBootstrapTable"));
				 alertSwal.confirm("删除","是否删除该任务",function(){
					    var ajaxUrl = "/pmp/service/pm/pmpBugs/setPmpBugsStatus";
						zfesAjax.ajaxTodo(ajaxUrl, { "id" : id,"status" : "-1"}, function(data) {
							alertSwal.successText(data.message);
							_this.refresh();
						}); 
			});
		}
  	 }
  	  
  	
   }

});
</script>


